package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.MarketMerchantGiftPacketSales;
import com.rockcent.mall.lib.domain.enumclass.MarketMerchantProductSalesStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by DK on 16/10/18.
 */
@Repository
public interface MarketMerchantGiftPacketSalesRepository extends JpaRepository<MarketMerchantGiftPacketSales, Long>, JpaSpecificationExecutor {

    List<MarketMerchantGiftPacketSales> findByPacketIdAndDistributorMerchantIdAndDistributorMallIdAndIsDeleteAndDistributorStatusOrderByIdDesc(Long packetId, Long distributorMerchantId, Long DistributorMallId, Whether isDelete, MarketMerchantProductSalesStatus status);

    MarketMerchantGiftPacketSales findByPacketIdAndDistributorMerchantIdAndDistributorMallIdAndIsDeleteAndDistributorStatus(Long packetId, Long distributorMerchantId, Long DistributorMallId,  Whether isDelete, MarketMerchantProductSalesStatus status);

    List<MarketMerchantGiftPacketSales> findByPacketIdAndSupplierMallIdAndSupplierMerchantIdAndDistributorMallIdAndDistributorMerchantIdAndDistributorStatus(Long id, Long mallId, Long merchantId, Long id1, Long id2, MarketMerchantProductSalesStatus refuse);
}
